package main

import (
	"imooc.com/crawler/engine"
	"imooc.com/crawler/zhenai/parser"
	"imooc.com/crawler/scheduler"
	"imooc.com/crawler/persist"
)

func main() {

	itemChan, err := persist.ItemSaver("dating_profile");
	if err != nil {
		panic(err)
	}
	e := engine.ConcurrentEngine{
		Scheduler: &scheduler.QueuedScheduler{},
		WorkerCount: 100,
		ItemChan: itemChan,
		RequestProcessor:engine.Worker,
	}
	//e.Run(engine.Request{
	//	Url: 		"https://www.zhenai.com/zhenghun",
	//	Parser: engine.NewFuncParser(parser.ParseCityList, "ParseCityList"),
	//})
	//测试单个城市
	//e.Run(engine.Request{
	//	Url: "https://www.zhenai.com/zhenghun/shanghai",
	//	Parser: engine.NewFuncParser(parser.ParseCity, "ParseCity"),
	//})
    c :=  parser.NewParseProfile("Wensy")
    c.Parse(nil, "https://album.zhenai.com/u/101184438")
	e.Run(engine.Request{
		Url: "https://album.zhenai.com/u/101184438",
		Parser: c,
	})
}

